package com.gaofeng.day21;

import java.util.ArrayList;
import java.util.Collections;
import java.util.function.Predicate;

public class demo06 {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
        Collections.addAll(list,"张三丰","张无忌","小昭");

//        list.stream().filter(new Predicate<String>() {
//            @Override
//            public boolean test(String s) {
//                return s.startsWith("张") &&  s.length() == 3;
//            }
//        }).forEach(s -> System.out.println(s));
//        StringOperation so = new StringOperation();
//        list.stream().filter(so::stringJudge).forEach(s -> System.out.println(s));
        demo06 so = new demo06();
        list.stream().filter(so::stringJudge).forEach(s -> System.out.println(s));
    }

    public boolean stringJudge(String name){
        return  name.startsWith("张") && name.length() == 3;
    }
}
